/**
 * @author kristian
 */

dojo.require("dojox.json.schema");
dojo.require("dojox.json.ref");

var john = {
	id: 'person_John',
	name: {
		first: 'John',
		last: 'Smith'
	},
	age: 46,
	myChildren: {
		boys: [{
			"$ref": "person_Jack"
		}, 
		{
			"$ref": "person_Jimmy"}
	]},
	friends: [
		{
				id: 'person_Roger',
				age: 48,
				name: {first: 'Roger', last: 'Wise'}, 
				gender: 'male'
		}	
	],		
	gender: 'male'
}

var susan = {
		id: 'person_Susan', 
		name: {first: 'Susan', last: 'Smith Johnson'}, 
		age: 41,
		myChildren: { 
			girls:[{"$ref": "person_Julie"}],
			boys:[{"$ref": "person_Jack"}]
		}, 
		gender:'female'
};	

var julie = {
		id: 'person_Julie',
		name: {first: 'Julie', last: 'Johnson'},
		age: 15,
		friends: [
			{
					id: 'person_Ally',
					age: 14,
					name: {first: 'Ally', last: 'Sweet'}, 
					gender: 'male'
			}	
		],		
		gender: 'female'
}

var jimmy = {
	id: 'person_Jimmy', 
	name: {first: 'Jimmy', last: 'Smith'},
	age: 12, 
	siblings: [{
			"$ref": "person_Jack"
	}],
	gender: 'male'
};

var jack = {
	id: 'person_Jack', 
	name: {first: 'Jack', last: 'Smith'}, 
	age: 17,
	siblings: [{
			"$ref": "person_Julie"		
	}],
	gender: 'male'
};

var personsModel = [john, susan, jack, jimmy, julie];

// var resolvedPersonsModel = dojox.json.ref.resolveJson(personsModel);